package io.lckgroup.modules.lck.controller.wxgzh;

import io.lckgroup.common.utils.PageUtils;
import io.lckgroup.common.utils.R;
import io.lckgroup.modules.lck.service.ShopMerchantInfoService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

import java.util.Map;

/**
 * 公众号商家信息查询
 */
@RestController
@RequestMapping("/mp/wxMerchant")
public class WxMerchantInfoController {

    @Autowired
    private ShopMerchantInfoService shopMerchantInfoService;

    /**
     * 分页查询所有商家信息
     * 传入页数和每页条数和排序条件
     *
     * @return
     */
    @GetMapping("/wxlist")
//    @WxLogin
    public R list(@RequestParam Map<String, Object> params) {
//        PageUtils page = shopMerchantInfoService.queryPage(params);
        PageUtils page = shopMerchantInfoService.getShopMerchantByCondition(params);
        return R.ok().put("page", page);
    }
    /**
     * 根据搜索关键字分页查询商家信息
     * 传入页数和每页条数和搜索关键字和排序条件
     *
     * @return
     */
    @GetMapping("/wxSearchList")
    public R search(@RequestParam Map<String, Object> params){
        PageUtils page = shopMerchantInfoService.getShopMerchantByConditionAndSearch(params);
        return R.ok().put("page", page);
    }
}
